Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tty: move from libc to nix #3838

Merged
merged 1 commit into from
Aug 19, 2022
Merged

tty: move from libc to nix #3838

merged 1 commit into from
Aug 19, 2022

Conversation

tertsdiepraam
Copy link
Member

@tertsdiepraam tertsdiepraam commented Aug 17, 2022

This moves the responsibility for unsafe from us to nix and makes the code a bit cleaner as a result.

As an optimization, I moved the isatty check to before getting the name if the silent option is passed with an early return. The functionality should stay exactly the same.

Notes:

  • I removed the is_whitespace check. This check has been in the code since the very first commit (f0be827), but it seems to check for the same thing as the error code. So as far as I can tell, it was not necessary now that we have a nice result type from nix.
  • I also removed the collect_lossy call because there are only flags, so the handling of invalid encoding doesn't matter.

This moves the unsafe from our responsibility to nix and makes
the code a bit cleaner.
@sylvestre sylvestre merged commit a3e3542 into uutils:main Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants